class Solution
{
public:
    long long makeSimilar(vector<int> &nums, vector<int> &target)
    {
        auto compare = [](int l, int r)
        {
            if ((l & 1) && !(r & 1))
            {
                return true;
            }
            else if (!(l & 1) && (r & 1))
            {
                return false;
            }
            else
            {
                return l < r;
            }
        };
        sort(nums.begin(), nums.end(), compare);
        sort(target.begin(), target.end(), compare);
        long long step = 0;
        int n = nums.size();
        for (int i = 0; i < n; ++i)
        {
            step += abs(nums[i] - target[i]);
        }
        step = step >> 2;
        return step;
    }
};